home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / manual-p / man_db-2.000 / man_db-2 / man_db-2.3.10 / xcat / xcat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-05  |  41.8 KB  |  1,748 lines

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* Scanner skeleton version:
  4.  * $Header: /home/wilf/C/man_db-2.3.8-orig/xcat/RCS/xcat.c,v 23.80 1995/06/05 16:00:03 wilf Exp wilf $
  5.  */
  6.  
  7. #define FLEX_SCANNER
  8. #define YY_FLEX_MAJOR_VERSION 2
  9. #define YY_FLEX_MINOR_VERSION 5
  10.  
  11. #include <stdio.h>
  12.  
  13.  
  14. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  15. #ifdef c_plusplus
  16. #ifndef __cplusplus
  17. #define __cplusplus
  18. #endif
  19. #endif
  20.  
  21.  
  22. #ifdef __cplusplus
  23.  
  24. #include <stdlib.h>
  25. #include <unistd.h>
  26.  
  27. /* Use prototypes in function declarations. */
  28. #define YY_USE_PROTOS
  29.  
  30. /* The "const" storage-class-modifier is valid. */
  31. #define YY_USE_CONST
  32.  
  33. #else    /* ! __cplusplus */
  34.  
  35. #if __STDC__
  36.  
  37. #define YY_USE_PROTOS
  38. #define YY_USE_CONST
  39.  
  40. #endif    /* __STDC__ */
  41. #endif    /* ! __cplusplus */
  42.  
  43. #ifdef __TURBOC__
  44.  #pragma warn -rch
  45.  #pragma warn -use
  46. #include <io.h>
  47. #include <stdlib.h>
  48. #define YY_USE_CONST
  49. #define YY_USE_PROTOS
  50. #endif
  51.  
  52. #ifdef YY_USE_CONST
  53. #define yyconst const
  54. #else
  55. #define yyconst
  56. #endif
  57.  
  58.  
  59. #ifdef YY_USE_PROTOS
  60. #define YY_PROTO(proto) proto
  61. #else
  62. #define YY_PROTO(proto) ()
  63. #endif
  64.  
  65. /* Returned upon end-of-file. */
  66. #define YY_NULL 0
  67.  
  68. /* Promotes a possibly negative, possibly signed char to an unsigned
  69.  * integer for use as an array index.  If the signed char is negative,
  70.  * we want to instead treat it as an 8-bit unsigned char, hence the
  71.  * double cast.
  72.  */
  73. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  74.  
  75. /* Enter a start condition.  This macro really ought to take a parameter,
  76.  * but we do it the disgusting crufty way forced on us by the ()-less
  77.  * definition of BEGIN.
  78.  */
  79. #define BEGIN yy_start = 1 + 2 *
  80.  
  81. /* Translate the current start state into a value that can be later handed
  82.  * to BEGIN to return to the state.  The YYSTATE alias is for lex
  83.  * compatibility.
  84.  */
  85. #define YY_START ((yy_start - 1) / 2)
  86. #define YYSTATE YY_START
  87.  
  88. /* Action number for EOF rule of a given start state. */
  89. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  90.  
  91. /* Special action meaning "start processing a new file". */
  92. #define YY_NEW_FILE yyrestart( yyin )
  93.  
  94. #define YY_END_OF_BUFFER_CHAR 0
  95.  
  96. /* Size of default input buffer. */
  97. #define YY_BUF_SIZE 16384
  98.  
  99. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  100.  
  101. extern int yyleng;
  102. extern FILE *yyin, *yyout;
  103.  
  104. #define EOB_ACT_CONTINUE_SCAN 0
  105. #define EOB_ACT_END_OF_FILE 1
  106. #define EOB_ACT_LAST_MATCH 2
  107.  
  108. /* The funky do-while in the following #define is used to turn the definition
  109.  * int a single C statement (which needs a semi-colon terminator).  This
  110.  * avoids problems with code like:
  111.  *
  112.  *     if ( condition_holds )
  113.  *        yyless( 5 );
  114.  *    else
  115.  *        do_something_else();
  116.  *
  117.  * Prior to using the do-while the compiler would get upset at the
  118.  * "else" because it interpreted the "if" statement as being all
  119.  * done when it reached the ';' after the yyless() call.
  120.  */
  121.  
  122. /* Return all but the first 'n' matched characters back to the input stream. */
  123.  
  124. #define yyless(n) \
  125.     do \
  126.         { \
  127.         /* Undo effects of setting up yytext. */ \
  128.         *yy_cp = yy_hold_char; \
  129.         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
  130.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  131.         } \
  132.     while ( 0 )
  133.  
  134. #define unput(c) yyunput( c, yytext_ptr )
  135.  
  136. /* The following is because we cannot portably get our hands on size_t
  137.  * (without autoconf's help, which isn't available because we want
  138.  * flex-generated scanners to compile on their own).
  139.  */
  140. typedef unsigned int yy_size_t;
  141.  
  142.  
  143. struct yy_buffer_state
  144.     {
  145.     FILE *yy_input_file;
  146.  
  147.     char *yy_ch_buf;        /* input buffer */
  148.     char *yy_buf_pos;        /* current position in input buffer */
  149.  
  150.     /* Size of input buffer in bytes, not including room for EOB
  151.      * characters.
  152.      */
  153.     yy_size_t yy_buf_size;
  154.  
  155.     /* Number of characters read into yy_ch_buf, not including EOB
  156.      * characters.
  157.      */
  158.     int yy_n_chars;
  159.  
  160.     /* Whether we "own" the buffer - i.e., we know we created it,
  161.      * and can realloc() it to grow it, and should free() it to
  162.      * delete it.
  163.      */
  164.     int yy_is_our_buffer;
  165.  
  166.     /* Whether this is an "interactive" input source; if so, and
  167.      * if we're using stdio for input, then we want to use getc()
  168.      * instead of fread(), to make sure we stop fetching input after
  169.      * each newline.
  170.      */
  171.     int yy_is_interactive;
  172.  
  173.     /* Whether we're considered to be at the beginning of a line.
  174.      * If so, '^' rules will be active on the next match, otherwise
  175.      * not.
  176.      */
  177.     int yy_at_bol;
  178.  
  179.     /* Whether to try to fill the input buffer when we reach the
  180.      * end of it.
  181.      */
  182.     int yy_fill_buffer;
  183.  
  184.     int yy_buffer_status;
  185. #define YY_BUFFER_NEW 0
  186. #define YY_BUFFER_NORMAL 1
  187.     /* When an EOF's been seen but there's still some text to process
  188.      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  189.      * shouldn't try reading from the input source any more.  We might
  190.      * still have a bunch of tokens to match, though, because of
  191.      * possible backing-up.
  192.      *
  193.      * When we actually see the EOF, we change the status to "new"
  194.      * (via yyrestart()), so that the user can continue scanning by
  195.      * just pointing yyin at a new input file.
  196.      */
  197. #define YY_BUFFER_EOF_PENDING 2
  198.     };
  199.  
  200. static YY_BUFFER_STATE yy_current_buffer = 0;
  201.  
  202. /* We provide macros for accessing buffer states in case in the
  203.  * future we want to put the buffer states in a more general
  204.  * "scanner state".
  205.  */
  206. #define YY_CURRENT_BUFFER yy_current_buffer
  207.  
  208.  
  209. /* yy_hold_char holds the character lost when yytext is formed. */
  210. static char yy_hold_char;
  211.  
  212. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  213.  
  214.  
  215. int yyleng;
  216.  
  217. /* Points to current character in buffer. */
  218. static char *yy_c_buf_p = (char *) 0;
  219. static int yy_init = 1;        /* whether we need to initialize */
  220. static int yy_start = 0;    /* start state number */
  221.  
  222. /* Flag which is used to allow yywrap()'s to do buffer switches
  223.  * instead of setting up a fresh yyin.  A bit of a hack ...
  224.  */
  225. static int yy_did_buffer_switch_on_eof;
  226.  
  227. void yyrestart YY_PROTO(( FILE *input_file ));
  228.  
  229. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  230. void yy_load_buffer_state YY_PROTO(( void ));
  231. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  232. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  233. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  234. void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  235. #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
  236.  
  237. YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
  238. YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
  239. YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
  240.  
  241. static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
  242. static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
  243. static void yy_flex_free YY_PROTO(( void * ));
  244.  
  245. #define yy_new_buffer yy_create_buffer
  246.  
  247. #define yy_set_interactive(is_interactive) \
  248.     { \
  249.     if ( ! yy_current_buffer ) \
  250.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  251.     yy_current_buffer->yy_is_interactive = is_interactive; \
  252.     }
  253.  
  254. #define yy_set_bol(at_bol) \
  255.     { \
  256.     if ( ! yy_current_buffer ) \
  257.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  258.     yy_current_buffer->yy_at_bol = at_bol; \
  259.     }
  260.  
  261. #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
  262.  
  263. typedef unsigned char YY_CHAR;
  264. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  265. typedef int yy_state_type;
  266. extern char *yytext;
  267. #define yytext_ptr yytext
  268.  
  269. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  270. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  271. static int yy_get_next_buffer YY_PROTO(( void ));
  272. static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
  273.  
  274. /* Done after the current pattern has been matched and before the
  275.  * corresponding action - sets up yytext.
  276.  */
  277. #define YY_DO_BEFORE_ACTION \
  278.     yytext_ptr = yy_bp; \
  279.     yyleng = (int) (yy_cp - yy_bp); \
  280.     yy_hold_char = *yy_cp; \
  281.     *yy_cp = '\0'; \
  282.     yy_c_buf_p = yy_cp;
  283.  
  284. #define YY_NUM_RULES 14
  285. #define YY_END_OF_BUFFER 15
  286. static yyconst short int yy_accept[58] =
  287.     {   0,
  288.         0,    0,    9,    9,    0,    0,    5,    5,    0,    0,
  289.         0,    0,   15,   13,   13,    9,   12,   14,    4,    8,
  290.        14,    5,    7,    6,    2,   13,    0,    9,   11,   10,
  291.         4,    5,    2,    0,    0,    0,    0,    0,    0,    0,
  292.         0,    0,    0,    0,    0,    0,    3,    0,    3,    0,
  293.         0,    0,    0,    0,    0,    1,    0
  294.     } ;
  295.  
  296. static yyconst int yy_ec[256] =
  297.     {   0,
  298.         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  299.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  300.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  301.         1,    2,    1,    4,    5,    1,    1,    1,    1,    6,
  302.         7,    1,    1,    8,    1,    1,    1,    1,    1,    1,
  303.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  304.         1,    1,    1,    1,    9,    1,   10,    1,   11,    1,
  305.        12,    1,    1,    1,    1,   13,    1,   14,    1,    1,
  306.         1,    1,   15,   16,    1,    1,    1,    1,    1,    1,
  307.         1,   17,    1,    1,   18,    1,    1,    1,    1,   19,
  308.  
  309.        20,   21,    1,    1,   22,    1,    1,    1,    1,   23,
  310.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  311.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  312.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  313.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  314.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  315.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  316.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  317.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  318.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  319.  
  320.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  321.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  322.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  323.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  324.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  325.         1,    1,    1,    1,    1
  326.     } ;
  327.  
  328. static yyconst int yy_meta[24] =
  329.     {   0,
  330.         1,    2,    2,    3,    1,    1,    4,    5,    1,    1,
  331.         1,    1,    1,    1,    1,    1,    6,    1,    1,    1,
  332.         1,    1,    1
  333.     } ;
  334.  
  335. static yyconst short int yy_base[68] =
  336.     {   0,
  337.       112,  111,    0,    1,   17,   24,   31,   38,    4,    7,
  338.       105,  104,  113,  118,   93,    0,  118,  107,    0,  118,
  339.       118,    0,  118,  118,    0,  101,   89,    0,  118,  118,
  340.         0,    0,    0,   92,   86,   91,   80,   88,   75,   81,
  341.        76,   78,   89,   10,    0,   41,   20,   77,   27,   65,
  342.        19,   21,   20,    8,   13,    1,  118,   47,   53,   59,
  343.        65,   71,   77,   82,   88,   94,  100
  344.     } ;
  345.  
  346. static yyconst short int yy_def[68] =
  347.     {   0,
  348.        58,   58,   59,   59,   60,   60,   61,   61,   62,   62,
  349.        58,   58,   57,   57,   57,   63,   57,   64,   65,   57,
  350.        57,   66,   57,   57,   67,   57,   57,   63,   57,   57,
  351.        65,   66,   67,   57,   57,   57,   57,   57,   57,   57,
  352.        57,   57,   57,   57,   57,   57,   57,   57,   57,   57,
  353.        57,   57,   57,   57,   57,   57,    0,   57,   57,   57,
  354.        57,   57,   57,   57,   57,   57,   57
  355.     } ;
  356.  
  357. static yyconst short int yy_nxt[142] =
  358.     {   0,
  359.        57,   45,   56,   17,   17,   21,   21,   21,   21,   21,
  360.        21,   46,   46,   48,   56,   47,   18,   18,   20,   20,
  361.        21,   49,   49,   55,   20,   20,   20,   21,   49,   49,
  362.        54,   20,   20,   20,   23,   53,   52,   24,   20,   20,
  363.        20,   23,   46,   46,   24,   20,   47,   14,   14,   14,
  364.        14,   14,   14,   16,   16,   16,   16,   16,   16,   19,
  365.        19,   19,   19,   19,   19,   22,   22,   22,   22,   22,
  366.        22,   25,   25,   25,   25,   25,   25,   28,   28,   51,
  367.        28,   28,   29,   29,   29,   29,   29,   29,   31,   50,
  368.        45,   31,   44,   31,   32,   43,   42,   41,   40,   32,
  369.  
  370.        33,   39,   38,   33,   33,   33,   37,   36,   35,   34,
  371.        30,   27,   57,   26,   26,   15,   15,   13,   57,   57,
  372.        57,   57,   57,   57,   57,   57,   57,   57,   57,   57,
  373.        57,   57,   57,   57,   57,   57,   57,   57,   57,   57,
  374.        57
  375.     } ;
  376.  
  377. static yyconst short int yy_chk[142] =
  378.     {   0,
  379.         0,   45,   56,    3,    4,    9,    9,    9,   10,   10,
  380.        10,   44,   44,   45,   55,   44,    3,    4,    5,    5,
  381.         5,   47,   47,   54,    5,    6,    6,    6,   49,   49,
  382.        53,    6,    7,    7,    7,   52,   51,    7,    7,    8,
  383.         8,    8,   46,   46,    8,    8,   46,   58,   58,   58,
  384.        58,   58,   58,   59,   59,   59,   59,   59,   59,   60,
  385.        60,   60,   60,   60,   60,   61,   61,   61,   61,   61,
  386.        61,   62,   62,   62,   62,   62,   62,   63,   63,   50,
  387.        63,   63,   64,   64,   64,   64,   64,   64,   65,   48,
  388.        43,   65,   42,   65,   66,   41,   40,   39,   38,   66,
  389.  
  390.        67,   37,   36,   67,   67,   67,   35,   34,   27,   26,
  391.        18,   15,   13,   12,   11,    2,    1,   57,   57,   57,
  392.        57,   57,   57,   57,   57,   57,   57,   57,   57,   57,
  393.        57,   57,   57,   57,   57,   57,   57,   57,   57,   57,
  394.        57
  395.     } ;
  396.  
  397. static yy_state_type yy_last_accepting_state;
  398. static char *yy_last_accepting_cpos;
  399.  
  400. /* The intent behind this definition is that it'll catch
  401.  * any uses of REJECT which flex missed.
  402.  */
  403. #define REJECT reject_used_but_not_detected
  404. #define yymore() yymore_used_but_not_detected
  405. #define YY_MORE_ADJ 0
  406. char *yytext;
  407. #line 1 "xcat.l"
  408. #define INITIAL 0
  409. #line 2 "xcat.l"
  410.  
  411. /*
  412.  * xcat: produce .m file from .c file for gencat 
  413.  *  
  414.  * Copyright (C), 1994, 1995, Graeme W. Wilford. (Wilf.)
  415.  *
  416.  * You may distribute under the terms of the GNU General Public
  417.  * License as specified in the file COPYING that comes with this
  418.  * distribution.
  419.  *
  420.  * This program should be used with C programs containing certain 
  421.  * directives, specifically CATGETS() and NLS_SET should be #defined.
  422.  *
  423.  * usage: xcat Register < foo.c > foo.m
  424.  *
  425.  * Wed Oct 12 18:46:11 BST 1994  Wilf. (G.Wilford@ee.surrey.ac.uk) 
  426.  */
  427.  
  428. /* This program provides a basic method of producing message catalogues
  429.    for C source files. Each C source file must define NLS_SET prior to
  430.    #including "nls.h", which will set up the CATGETS() macro. eg
  431.  
  432.    #define NLS_SET    <file_id>Set
  433.    #include "nls.h"
  434.  
  435.    where <file_id> is a unique file id such as the filename itself.
  436.    From then on, you may use the following CATGETS() function instead of 
  437.    the library function catgets(). The CATGETS function is defined:
  438.  
  439.    char * CATGETS(int id, char *message)
  440.  
  441.    where id is the name <file_id>_<message_id>, message_id being any upper
  442.    case name that uniquely identifies the message. Identical messages may
  443.    have identical message id's. 
  444.  
  445.    gencat can be used to process the message file produced, and should also
  446.    be used to create a macro header file. This header will contain definitions
  447.    of all of the <file_id>_<message_id> names you used. These map to integers.
  448.  */
  449.  
  450. #define MAX_MSGS    100    /* maximum number of messages per C-file */
  451. #define NLS_TEXT    ""    /* bogus string prepended to each message
  452.                    for debugging purposes, set to "" if
  453.                    preferred  */ 
  454. #define STATIC_VER
  455.  
  456. #ifdef HAVE_CONFIG_H
  457. #  include "config.h"
  458. #endif /* HAVE_CONFIG_H */
  459.  
  460. #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  461. #  include <string.h>
  462. #elif defined(HAVE_STRINGS_H)
  463. #  include <strings.h>
  464. #endif /* STDC_HEADERS */
  465.  
  466. #ifdef HAVE_UNISTD_H
  467. #  include <unistd.h>
  468. #endif /* HAVE_UNISTD_H */
  469.  
  470. #include <ctype.h>
  471.  
  472. #include "manconfig.h"
  473. #include "lib/error.h"
  474.  
  475. static int get_set_number(void);
  476.  
  477. char *program_name = "xcat";
  478. static short Set_len;
  479. static char ch, *register_file = NULL;
  480. static char buffer[4096];
  481. #define in_string 1
  482.  
  483. #define catgets_arg1 2
  484.  
  485. #define catgets_rest 3
  486.  
  487. #define in_Set 4
  488.  
  489. #define normal 5
  490.  
  491.  
  492. /* Macros after this point can all be overridden by user definitions in
  493.  * section 1.
  494.  */
  495.  
  496. #ifndef YY_SKIP_YYWRAP
  497. #ifdef __cplusplus
  498. extern "C" int yywrap YY_PROTO(( void ));
  499. #else
  500. extern int yywrap YY_PROTO(( void ));
  501. #endif
  502. #endif
  503.  
  504. #ifndef YY_NO_UNPUT
  505. static void yyunput YY_PROTO(( int c, char *buf_ptr ));
  506. #endif
  507.  
  508. #ifndef yytext_ptr
  509. static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
  510. #endif
  511.  
  512. #ifndef YY_NO_INPUT
  513. #ifdef __cplusplus
  514. static int yyinput YY_PROTO(( void ));
  515. #else
  516. static int input YY_PROTO(( void ));
  517. #endif
  518. #endif
  519.  
  520. #if YY_STACK_USED
  521. static int yy_start_stack_ptr = 0;
  522. static int yy_start_stack_depth = 0;
  523. static int *yy_start_stack = 0;
  524. #ifndef YY_NO_PUSH_STATE
  525. static void yy_push_state YY_PROTO(( int new_state ));
  526. #endif
  527. #ifndef YY_NO_POP_STATE
  528. static void yy_pop_state YY_PROTO(( void ));
  529. #endif
  530. #ifndef YY_NO_TOP_STATE
  531. static int yy_top_state YY_PROTO(( void ));
  532. #endif
  533.  
  534. #else
  535. #define YY_NO_PUSH_STATE 1
  536. #define YY_NO_POP_STATE 1
  537. #define YY_NO_TOP_STATE 1
  538. #endif
  539.  
  540. #ifdef YY_MALLOC_DECL
  541. YY_MALLOC_DECL
  542. #else
  543. #if __STDC__
  544. #ifndef __cplusplus
  545. #include <stdlib.h>
  546. #endif
  547. #else
  548. /* Just try to get by without declaring the routines.  This will fail
  549.  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
  550.  * or sizeof(void*) != sizeof(int).
  551.  */
  552. #endif
  553. #endif
  554.  
  555. /* Amount of stuff to slurp up with each read. */
  556. #ifndef YY_READ_BUF_SIZE
  557. #define YY_READ_BUF_SIZE 8192
  558. #endif
  559.  
  560. /* Copy whatever the last rule matched to the standard output. */
  561.  
  562. #ifndef ECHO
  563. /* This used to be an fputs(), but since the string might contain NUL's,
  564.  * we now use fwrite().
  565.  */
  566. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  567. #endif
  568.  
  569. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  570.  * is returned in "result".
  571.  */
  572. #ifndef YY_INPUT
  573. #define YY_INPUT(buf,result,max_size) \
  574.     if ( yy_current_buffer->yy_is_interactive ) \
  575.         { \
  576.         int c = '*', n; \
  577.         for ( n = 0; n < max_size && \
  578.                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  579.             buf[n] = (char) c; \
  580.         if ( c == '\n' ) \
  581.             buf[n++] = (char) c; \
  582.         if ( c == EOF && ferror( yyin ) ) \
  583.             YY_FATAL_ERROR( "input in flex scanner failed" ); \
  584.         result = n; \
  585.         } \
  586.     else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
  587.           && ferror( yyin ) ) \
  588.         YY_FATAL_ERROR( "input in flex scanner failed" );
  589. #endif
  590.  
  591. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  592.  * we don't want an extra ';' after the "return" because that will cause
  593.  * some compilers to complain about unreachable statements.
  594.  */
  595. #ifndef yyterminate
  596. #define yyterminate() return YY_NULL
  597. #endif
  598.  
  599. /* Number of entries by which start-condition stack grows. */
  600. #ifndef YY_START_STACK_INCR
  601. #define YY_START_STACK_INCR 25
  602. #endif
  603.  
  604. /* Report a fatal error. */
  605. #ifndef YY_FATAL_ERROR
  606. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  607. #endif
  608.  
  609. /* Default declaration of generated scanner - a define so the user can
  610.  * easily add parameters.
  611.  */
  612. #ifndef YY_DECL
  613. #define YY_DECL int yylex YY_PROTO(( void ))
  614. #endif
  615.  
  616. /* Code executed at the beginning of each rule, after yytext and yyleng
  617.  * have been set up.
  618.  */
  619. #ifndef YY_USER_ACTION
  620. #define YY_USER_ACTION
  621. #endif
  622.  
  623. /* Code executed at the end of each rule. */
  624. #ifndef YY_BREAK
  625. #define YY_BREAK break;
  626. #endif
  627.  
  628. #define YY_RULE_SETUP \
  629.     YY_USER_ACTION
  630.  
  631. YY_DECL
  632.     {
  633.     register yy_state_type yy_current_state;
  634.     register char *yy_cp, *yy_bp;
  635.     register int yy_act;
  636.  
  637. #line 81 "xcat.l"
  638.  
  639.  
  640.  
  641.     if ( yy_init )
  642.         {
  643.         yy_init = 0;
  644.  
  645. #ifdef YY_USER_INIT
  646.         YY_USER_INIT;
  647. #endif
  648.  
  649.         if ( ! yy_start )
  650.             yy_start = 1;    /* first start state */
  651.  
  652.         if ( ! yyin )
  653.             yyin = stdin;
  654.  
  655.         if ( ! yyout )
  656.             yyout = stdout;
  657.  
  658.         if ( ! yy_current_buffer )
  659.             yy_current_buffer =
  660.                 yy_create_buffer( yyin, YY_BUF_SIZE );
  661.  
  662.         yy_load_buffer_state();
  663.         }
  664.  
  665.     while ( 1 )        /* loops until end-of-file is reached */
  666.         {
  667.         yy_cp = yy_c_buf_p;
  668.  
  669.         /* Support of yytext. */
  670.         *yy_cp = yy_hold_char;
  671.  
  672.         /* yy_bp points to the position in yy_ch_buf of the start of
  673.          * the current run.
  674.          */
  675.         yy_bp = yy_cp;
  676.  
  677.         yy_current_state = yy_start;
  678. yy_match:
  679.         do
  680.             {
  681.             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  682.             if ( yy_accept[yy_current_state] )
  683.                 {
  684.                 yy_last_accepting_state = yy_current_state;
  685.                 yy_last_accepting_cpos = yy_cp;
  686.                 }
  687.             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  688.                 {
  689.                 yy_current_state = (int) yy_def[yy_current_state];
  690.                 if ( yy_current_state >= 58 )
  691.                     yy_c = yy_meta[(unsigned int) yy_c];
  692.                 }
  693.             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  694.             ++yy_cp;
  695.             }
  696.         while ( yy_current_state != 57 );
  697.         yy_cp = yy_last_accepting_cpos;
  698.         yy_current_state = yy_last_accepting_state;
  699.  
  700. yy_find_action:
  701.         yy_act = yy_accept[yy_current_state];
  702.  
  703.         YY_DO_BEFORE_ACTION;
  704.  
  705.  
  706. do_action:    /* This label is used only to access EOF actions. */
  707.  
  708.  
  709.         switch ( yy_act )
  710.     { /* beginning of action switch */
  711.             case 0: /* must back up */
  712.             /* undo the effects of YY_DO_BEFORE_ACTION */
  713.             *yy_cp = yy_hold_char;
  714.             yy_cp = yy_last_accepting_cpos;
  715.             yy_current_state = yy_last_accepting_state;
  716.             goto yy_find_action;
  717.  
  718. case 1:
  719. YY_RULE_SETUP
  720. #line 83 "xcat.l"
  721. BEGIN(in_Set);
  722.     YY_BREAK
  723. case 2:
  724. YY_RULE_SETUP
  725. #line 84 "xcat.l"
  726. {
  727.             yytext[yyleng - 3] = '\0';
  728.             printf("$set %d #%s\n", get_set_number(), yytext);
  729.             Set_len = yyleng - 3;
  730.             BEGIN(normal);
  731.            }
  732.     YY_BREAK
  733. case 3:
  734. YY_RULE_SETUP
  735. #line 91 "xcat.l"
  736. BEGIN(catgets_arg1);
  737.     YY_BREAK
  738. case 4:
  739. YY_RULE_SETUP
  740. #line 92 "xcat.l"
  741. {
  742.             static struct {
  743.                 char *text;
  744.                 int seen;
  745.             } message[MAX_MSGS];
  746.             static int msg_no = 0;
  747.             int i = 0;
  748.  
  749.             /* don't duplicate messages with identical id's */
  750.             while (i != msg_no) {
  751.                 if (strcmp(message[i].text, yytext) == 0) {
  752.                     if (!message[i].seen) {
  753.                         error(0, 0, 
  754.                               "warning: duplicated message id: %s",
  755.                               yytext);
  756.                         message[i].seen = 1;
  757.                     }
  758.                     BEGIN(normal);
  759.                     i = -1;
  760.                     break;
  761.                 }
  762.                 i++;
  763.             }
  764.                 
  765.             if (i != -1) {
  766.                 message[msg_no++].text = xstrdup(yytext);
  767.                 yytext += Set_len;
  768.                 printf("\n$ #%s Original Message:", yytext);
  769.                 BEGIN(catgets_rest);
  770.                 ch = '\0';
  771.             }
  772.            }
  773.     YY_BREAK
  774. case 5:
  775. YY_RULE_SETUP
  776. #line 124 "xcat.l"
  777. strcat(buffer, yytext);
  778.     YY_BREAK
  779. case 6:
  780. YY_RULE_SETUP
  781. #line 125 "xcat.l"
  782. {
  783.             printf("(%s)\n# " NLS_TEXT "%s\n", buffer, buffer);
  784.             buffer[0] = '\0';
  785.             BEGIN(normal);
  786.            }
  787.     YY_BREAK
  788. case 7:
  789. YY_RULE_SETUP
  790. #line 130 "xcat.l"
  791. {    
  792.             if (ch)
  793.                 strcat(buffer, "\\\n");
  794.             BEGIN(in_string);
  795.             ch = '\\';
  796.            }
  797.     YY_BREAK
  798. case 8:
  799. YY_RULE_SETUP
  800. #line 136 "xcat.l"
  801.  
  802.     YY_BREAK
  803. case 9:
  804. YY_RULE_SETUP
  805. #line 137 "xcat.l"
  806. strcat(buffer, yytext);
  807.     YY_BREAK
  808. case 10:
  809. YY_RULE_SETUP
  810. #line 138 "xcat.l"
  811. putchar(*(yytext + 1));
  812.     YY_BREAK
  813. case 11:
  814. YY_RULE_SETUP
  815. #line 139 "xcat.l"
  816. strcat(buffer, yytext);
  817.     YY_BREAK
  818. case 12:
  819. YY_RULE_SETUP
  820. #line 140 "xcat.l"
  821. {
  822.             BEGIN(catgets_rest);
  823.            }
  824.     YY_BREAK
  825. case YY_STATE_EOF(in_string):
  826. case YY_STATE_EOF(catgets_arg1):
  827. case YY_STATE_EOF(catgets_rest):
  828. case YY_STATE_EOF(in_Set):
  829. #line 143 "xcat.l"
  830. {
  831.             error (0, 0, "fatal: EOF within CATGETS() or Set definition");
  832.             yyterminate();
  833.            }
  834.     YY_BREAK
  835. case 13:
  836. YY_RULE_SETUP
  837. #line 147 "xcat.l"
  838.  
  839.     YY_BREAK
  840. case 14:
  841. YY_RULE_SETUP
  842. #line 149 "xcat.l"
  843. ECHO;
  844.     YY_BREAK
  845. case YY_STATE_EOF(INITIAL):
  846. case YY_STATE_EOF(normal):
  847.     yyterminate();
  848.  
  849.     case YY_END_OF_BUFFER:
  850.         {
  851.         /* Amount of text matched not including the EOB char. */
  852.         int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
  853.  
  854.         /* Undo the effects of YY_DO_BEFORE_ACTION. */
  855.         *yy_cp = yy_hold_char;
  856.  
  857.         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
  858.             {
  859.             /* We're scanning a new file or input source.  It's
  860.              * possible that this happened because the user
  861.              * just pointed yyin at a new source and called
  862.              * yylex().  If so, then we have to assure
  863.              * consistency between yy_current_buffer and our
  864.              * globals.  Here is the right place to do so, because
  865.              * this is the first action (other than possibly a
  866.              * back-up) that will match for the new input source.
  867.              */
  868.             yy_n_chars = yy_current_buffer->yy_n_chars;
  869.             yy_current_buffer->yy_input_file = yyin;
  870.             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
  871.             }
  872.  
  873.         /* Note that here we test for yy_c_buf_p "<=" to the position
  874.          * of the first EOB in the buffer, since yy_c_buf_p will
  875.          * already have been incremented past the NUL character
  876.          * (since all states make transitions on EOB to the
  877.          * end-of-buffer state).  Contrast this with the test
  878.          * in input().
  879.          */
  880.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  881.             { /* This was really a NUL. */
  882.             yy_state_type yy_next_state;
  883.  
  884.             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
  885.  
  886.             yy_current_state = yy_get_previous_state();
  887.  
  888.             /* Okay, we're now positioned to make the NUL
  889.              * transition.  We couldn't have
  890.              * yy_get_previous_state() go ahead and do it
  891.              * for us because it doesn't know how to deal
  892.              * with the possibility of jamming (and we don't
  893.              * want to build jamming into it because then it
  894.              * will run more slowly).
  895.              */
  896.  
  897.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  898.  
  899.             yy_bp = yytext_ptr + YY_MORE_ADJ;
  900.  
  901.             if ( yy_next_state )
  902.                 {
  903.                 /* Consume the NUL. */
  904.                 yy_cp = ++yy_c_buf_p;
  905.                 yy_current_state = yy_next_state;
  906.                 goto yy_match;
  907.                 }
  908.  
  909.             else
  910.                 {
  911.                 yy_cp = yy_last_accepting_cpos;
  912.                 yy_current_state = yy_last_accepting_state;
  913.                 goto yy_find_action;
  914.                 }
  915.             }
  916.  
  917.         else switch ( yy_get_next_buffer() )
  918.             {
  919.             case EOB_ACT_END_OF_FILE:
  920.                 {
  921.                 yy_did_buffer_switch_on_eof = 0;
  922.  
  923.                 if ( yywrap() )
  924.                     {
  925.                     /* Note: because we've taken care in
  926.                      * yy_get_next_buffer() to have set up
  927.                      * yytext, we can now set up
  928.                      * yy_c_buf_p so that if some total
  929.                      * hoser (like flex itself) wants to
  930.                      * call the scanner after we return the
  931.                      * YY_NULL, it'll still work - another
  932.                      * YY_NULL will get returned.
  933.                      */
  934.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  935.  
  936.                     yy_act = YY_STATE_EOF(YY_START);
  937.                     goto do_action;
  938.                     }
  939.  
  940.                 else
  941.                     {
  942.                     if ( ! yy_did_buffer_switch_on_eof )
  943.                         YY_NEW_FILE;
  944.                     }
  945.                 break;
  946.                 }
  947.  
  948.             case EOB_ACT_CONTINUE_SCAN:
  949.                 yy_c_buf_p =
  950.                     yytext_ptr + yy_amount_of_matched_text;
  951.  
  952.                 yy_current_state = yy_get_previous_state();
  953.  
  954.                 yy_cp = yy_c_buf_p;
  955.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  956.                 goto yy_match;
  957.  
  958.             case EOB_ACT_LAST_MATCH:
  959.                 yy_c_buf_p =
  960.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  961.  
  962.                 yy_current_state = yy_get_previous_state();
  963.  
  964.                 yy_cp = yy_c_buf_p;
  965.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  966.                 goto yy_find_action;
  967.             }
  968.         break;
  969.         }
  970.  
  971.     default:
  972.         YY_FATAL_ERROR(
  973.             "fatal flex scanner internal error--no action found" );
  974.     } /* end of action switch */
  975.         } /* end of scanning one token */
  976.     } /* end of yylex */
  977.  
  978.  
  979. /* yy_get_next_buffer - try to read in a new buffer
  980.  *
  981.  * Returns a code representing an action:
  982.  *    EOB_ACT_LAST_MATCH -
  983.  *    EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  984.  *    EOB_ACT_END_OF_FILE - end of file
  985.  */
  986.  
  987. static int yy_get_next_buffer()
  988.     {
  989.     register char *dest = yy_current_buffer->yy_ch_buf;
  990.     register char *source = yytext_ptr;
  991.     register int number_to_move, i;
  992.     int ret_val;
  993.  
  994.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  995.         YY_FATAL_ERROR(
  996.         "fatal flex scanner internal error--end of buffer missed" );
  997.  
  998.     if ( yy_current_buffer->yy_fill_buffer == 0 )
  999.         { /* Don't try to fill the buffer, so this is an EOF. */
  1000.         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
  1001.             {
  1002.             /* We matched a singled characater, the EOB, so
  1003.              * treat this as a final EOF.
  1004.              */
  1005.             return EOB_ACT_END_OF_FILE;
  1006.             }
  1007.  
  1008.         else
  1009.             {
  1010.             /* We matched some text prior to the EOB, first
  1011.              * process it.
  1012.              */
  1013.             return EOB_ACT_LAST_MATCH;
  1014.             }
  1015.         }
  1016.  
  1017.     /* Try to read more data. */
  1018.  
  1019.     /* First move last chars to start of buffer. */
  1020.     number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
  1021.  
  1022.     for ( i = 0; i < number_to_move; ++i )
  1023.         *(dest++) = *(source++);
  1024.  
  1025.     if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1026.         /* don't do the read, it's not guaranteed to return an EOF,
  1027.          * just force an EOF
  1028.          */
  1029.         yy_n_chars = 0;
  1030.  
  1031.     else
  1032.         {
  1033.         int num_to_read =
  1034.             yy_current_buffer->yy_buf_size - number_to_move - 1;
  1035.  
  1036.         while ( num_to_read <= 0 )
  1037.             { /* Not enough room in the buffer - grow it. */
  1038. #ifdef YY_USES_REJECT
  1039.             YY_FATAL_ERROR(
  1040. "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
  1041. #else
  1042.  
  1043.             /* just a shorter name for the current buffer */
  1044.             YY_BUFFER_STATE b = yy_current_buffer;
  1045.  
  1046.             int yy_c_buf_p_offset =
  1047.                 (int) (yy_c_buf_p - b->yy_ch_buf);
  1048.  
  1049.             if ( b->yy_is_our_buffer )
  1050.                 {
  1051.                 int new_size = b->yy_buf_size * 2;
  1052.  
  1053.                 if ( new_size <= 0 )
  1054.                     b->yy_buf_size += b->yy_buf_size / 8;
  1055.                 else
  1056.                     b->yy_buf_size *= 2;
  1057.  
  1058.                 b->yy_ch_buf = (char *)
  1059.                     /* Include room in for 2 EOB chars. */
  1060.                     yy_flex_realloc( (void *) b->yy_ch_buf,
  1061.                              b->yy_buf_size + 2 );
  1062.                 }
  1063.             else
  1064.                 /* Can't grow it, we don't own it. */
  1065.                 b->yy_ch_buf = 0;
  1066.  
  1067.             if ( ! b->yy_ch_buf )
  1068.                 YY_FATAL_ERROR(
  1069.                 "fatal error - scanner input buffer overflow" );
  1070.  
  1071.             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  1072.  
  1073.             num_to_read = yy_current_buffer->yy_buf_size -
  1074.                         number_to_move - 1;
  1075. #endif
  1076.             }
  1077.  
  1078.         if ( num_to_read > YY_READ_BUF_SIZE )
  1079.             num_to_read = YY_READ_BUF_SIZE;
  1080.  
  1081.         /* Read in more data. */
  1082.         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  1083.             yy_n_chars, num_to_read );
  1084.         }
  1085.  
  1086.     if ( yy_n_chars == 0 )
  1087.         {
  1088.         if ( number_to_move == YY_MORE_ADJ )
  1089.             {
  1090.             ret_val = EOB_ACT_END_OF_FILE;
  1091.             yyrestart( yyin );
  1092.             }
  1093.  
  1094.         else
  1095.             {
  1096.             ret_val = EOB_ACT_LAST_MATCH;
  1097.             yy_current_buffer->yy_buffer_status =
  1098.                 YY_BUFFER_EOF_PENDING;
  1099.             }
  1100.         }
  1101.  
  1102.     else
  1103.         ret_val = EOB_ACT_CONTINUE_SCAN;
  1104.  
  1105.     yy_n_chars += number_to_move;
  1106.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1107.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1108.  
  1109.     yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
  1110.  
  1111.     return ret_val;
  1112.     }
  1113.  
  1114.  
  1115. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1116.  
  1117. static yy_state_type yy_get_previous_state()
  1118.     {
  1119.     register yy_state_type yy_current_state;
  1120.     register char *yy_cp;
  1121.  
  1122.     yy_current_state = yy_start;
  1123.  
  1124.     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  1125.         {
  1126.         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1127.         if ( yy_accept[yy_current_state] )
  1128.             {
  1129.             yy_last_accepting_state = yy_current_state;
  1130.             yy_last_accepting_cpos = yy_cp;
  1131.             }
  1132.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1133.             {
  1134.             yy_current_state = (int) yy_def[yy_current_state];
  1135.             if ( yy_current_state >= 58 )
  1136.                 yy_c = yy_meta[(unsigned int) yy_c];
  1137.             }
  1138.         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1139.         }
  1140.  
  1141.     return yy_current_state;
  1142.     }
  1143.  
  1144.  
  1145. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1146.  *
  1147.  * synopsis
  1148.  *    next_state = yy_try_NUL_trans( current_state );
  1149.  */
  1150.  
  1151. #ifdef YY_USE_PROTOS
  1152. static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
  1153. #else
  1154. static yy_state_type yy_try_NUL_trans( yy_current_state )
  1155. yy_state_type yy_current_state;
  1156. #endif
  1157.     {
  1158.     register int yy_is_jam;
  1159.     register char *yy_cp = yy_c_buf_p;
  1160.  
  1161.     register YY_CHAR yy_c = 1;
  1162.     if ( yy_accept[yy_current_state] )
  1163.         {
  1164.         yy_last_accepting_state = yy_current_state;
  1165.         yy_last_accepting_cpos = yy_cp;
  1166.         }
  1167.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1168.         {
  1169.         yy_current_state = (int) yy_def[yy_current_state];
  1170.         if ( yy_current_state >= 58 )
  1171.             yy_c = yy_meta[(unsigned int) yy_c];
  1172.         }
  1173.     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1174.     yy_is_jam = (yy_current_state == 57);
  1175.  
  1176.     return yy_is_jam ? 0 : yy_current_state;
  1177.     }
  1178.  
  1179.  
  1180. #ifndef YY_NO_UNPUT
  1181. #ifdef YY_USE_PROTOS
  1182. static void yyunput( int c, register char *yy_bp )
  1183. #else
  1184. static void yyunput( c, yy_bp )
  1185. int c;
  1186. register char *yy_bp;
  1187. #endif
  1188.     {
  1189.     register char *yy_cp = yy_c_buf_p;
  1190.  
  1191.     /* undo effects of setting up yytext */
  1192.     *yy_cp = yy_hold_char;
  1193.  
  1194.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1195.         { /* need to shift things up to make room */
  1196.         /* +2 for EOB chars. */
  1197.         register int number_to_move = yy_n_chars + 2;
  1198.         register char *dest = &yy_current_buffer->yy_ch_buf[
  1199.                     yy_current_buffer->yy_buf_size + 2];
  1200.         register char *source =
  1201.                 &yy_current_buffer->yy_ch_buf[number_to_move];
  1202.  
  1203.         while ( source > yy_current_buffer->yy_ch_buf )
  1204.             *--dest = *--source;
  1205.  
  1206.         yy_cp += (int) (dest - source);
  1207.         yy_bp += (int) (dest - source);
  1208.         yy_n_chars = yy_current_buffer->yy_buf_size;
  1209.  
  1210.         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1211.             YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1212.         }
  1213.  
  1214.     *--yy_cp = (char) c;
  1215.  
  1216.  
  1217.     yytext_ptr = yy_bp;
  1218.     yy_hold_char = *yy_cp;
  1219.     yy_c_buf_p = yy_cp;
  1220.     }
  1221. #endif    /* ifndef YY_NO_UNPUT */
  1222.  
  1223.  
  1224. #ifdef __cplusplus
  1225. static int yyinput()
  1226. #else
  1227. static int input()
  1228. #endif
  1229.     {
  1230.     int c;
  1231.  
  1232.     *yy_c_buf_p = yy_hold_char;
  1233.  
  1234.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1235.         {
  1236.         /* yy_c_buf_p now points to the character we want to return.
  1237.          * If this occurs *before* the EOB characters, then it's a
  1238.          * valid NUL; if not, then we've hit the end of the buffer.
  1239.          */
  1240.         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1241.             /* This was really a NUL. */
  1242.             *yy_c_buf_p = '\0';
  1243.  
  1244.         else
  1245.             { /* need more input */
  1246.             yytext_ptr = yy_c_buf_p;
  1247.             ++yy_c_buf_p;
  1248.  
  1249.             switch ( yy_get_next_buffer() )
  1250.                 {
  1251.                 case EOB_ACT_END_OF_FILE:
  1252.                     {
  1253.                     if ( yywrap() )
  1254.                         {
  1255.                         yy_c_buf_p =
  1256.                         yytext_ptr + YY_MORE_ADJ;
  1257.                         return EOF;
  1258.                         }
  1259.  
  1260.                     if ( ! yy_did_buffer_switch_on_eof )
  1261.                         YY_NEW_FILE;
  1262. #ifdef __cplusplus
  1263.                     return yyinput();
  1264. #else
  1265.                     return input();
  1266. #endif
  1267.                     }
  1268.  
  1269.                 case EOB_ACT_CONTINUE_SCAN:
  1270.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  1271.                     break;
  1272.  
  1273.                 case EOB_ACT_LAST_MATCH:
  1274. #ifdef __cplusplus
  1275.                     YY_FATAL_ERROR(
  1276.                     "unexpected last match in yyinput()" );
  1277. #else
  1278.                     YY_FATAL_ERROR(
  1279.                     "unexpected last match in input()" );
  1280. #endif
  1281.                 }
  1282.             }
  1283.         }
  1284.  
  1285.     c = *(unsigned char *) yy_c_buf_p;    /* cast for 8-bit char's */
  1286.     *yy_c_buf_p = '\0';    /* preserve yytext */
  1287.     yy_hold_char = *++yy_c_buf_p;
  1288.  
  1289.  
  1290.     return c;
  1291.     }
  1292.  
  1293.  
  1294. #ifdef YY_USE_PROTOS
  1295. void yyrestart( FILE *input_file )
  1296. #else
  1297. void yyrestart( input_file )
  1298. FILE *input_file;
  1299. #endif
  1300.     {
  1301.     if ( ! yy_current_buffer )
  1302.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  1303.  
  1304.     yy_init_buffer( yy_current_buffer, input_file );
  1305.     yy_load_buffer_state();
  1306.     }
  1307.  
  1308.  
  1309. #ifdef YY_USE_PROTOS
  1310. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  1311. #else
  1312. void yy_switch_to_buffer( new_buffer )
  1313. YY_BUFFER_STATE new_buffer;
  1314. #endif
  1315.     {
  1316.     if ( yy_current_buffer == new_buffer )
  1317.         return;
  1318.  
  1319.     if ( yy_current_buffer )
  1320.         {
  1321.         /* Flush out information for old buffer. */
  1322.         *yy_c_buf_p = yy_hold_char;
  1323.         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  1324.         yy_current_buffer->yy_n_chars = yy_n_chars;
  1325.         }
  1326.  
  1327.     yy_current_buffer = new_buffer;
  1328.     yy_load_buffer_state();
  1329.  
  1330.     /* We don't actually know whether we did this switch during
  1331.      * EOF (yywrap()) processing, but the only time this flag
  1332.      * is looked at is after yywrap() is called, so it's safe
  1333.      * to go ahead and always set it.
  1334.      */
  1335.     yy_did_buffer_switch_on_eof = 1;
  1336.     }
  1337.  
  1338.  
  1339. #ifdef YY_USE_PROTOS
  1340. void yy_load_buffer_state( void )
  1341. #else
  1342. void yy_load_buffer_state()
  1343. #endif
  1344.     {
  1345.     yy_n_chars = yy_current_buffer->yy_n_chars;
  1346.     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  1347.     yyin = yy_current_buffer->yy_input_file;
  1348.     yy_hold_char = *yy_c_buf_p;
  1349.     }
  1350.  
  1351.  
  1352. #ifdef YY_USE_PROTOS
  1353. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  1354. #else
  1355. YY_BUFFER_STATE yy_create_buffer( file, size )
  1356. FILE *file;
  1357. int size;
  1358. #endif
  1359.     {
  1360.     YY_BUFFER_STATE b;
  1361.  
  1362.     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1363.     if ( ! b )
  1364.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1365.  
  1366.     b->yy_buf_size = size;
  1367.  
  1368.     /* yy_ch_buf has to be 2 characters longer than the size given because
  1369.      * we need to put in 2 end-of-buffer characters.
  1370.      */
  1371.     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
  1372.     if ( ! b->yy_ch_buf )
  1373.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1374.  
  1375.     b->yy_is_our_buffer = 1;
  1376.  
  1377.     yy_init_buffer( b, file );
  1378.  
  1379.     return b;
  1380.     }
  1381.  
  1382.  
  1383. #ifdef YY_USE_PROTOS
  1384. void yy_delete_buffer( YY_BUFFER_STATE b )
  1385. #else
  1386. void yy_delete_buffer( b )
  1387. YY_BUFFER_STATE b;
  1388. #endif
  1389.     {
  1390.     if ( ! b )
  1391.         return;
  1392.  
  1393.     if ( b == yy_current_buffer )
  1394.         yy_current_buffer = (YY_BUFFER_STATE) 0;
  1395.  
  1396.     if ( b->yy_is_our_buffer )
  1397.         yy_flex_free( (void *) b->yy_ch_buf );
  1398.  
  1399.     yy_flex_free( (void *) b );
  1400.     }
  1401.  
  1402.  
  1403. #ifndef YY_ALWAYS_INTERACTIVE
  1404. #ifndef YY_NEVER_INTERACTIVE
  1405. extern int isatty YY_PROTO(( int ));
  1406. #endif
  1407. #endif
  1408.  
  1409. #ifdef YY_USE_PROTOS
  1410. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  1411. #else
  1412. void yy_init_buffer( b, file )
  1413. YY_BUFFER_STATE b;
  1414. FILE *file;
  1415. #endif
  1416.  
  1417.  
  1418.     {
  1419.     yy_flush_buffer( b );
  1420.  
  1421.     b->yy_input_file = file;
  1422.     b->yy_fill_buffer = 1;
  1423.  
  1424. #if YY_ALWAYS_INTERACTIVE
  1425.     b->yy_is_interactive = 1;
  1426. #else
  1427. #if YY_NEVER_INTERACTIVE
  1428.     b->yy_is_interactive = 0;
  1429. #else
  1430.     b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1431. #endif
  1432. #endif
  1433.     }
  1434.  
  1435.  
  1436. #ifdef YY_USE_PROTOS
  1437. void yy_flush_buffer( YY_BUFFER_STATE b )
  1438. #else
  1439. void yy_flush_buffer( b )
  1440. YY_BUFFER_STATE b;
  1441. #endif
  1442.  
  1443.     {
  1444.     b->yy_n_chars = 0;
  1445.  
  1446.     /* We always need two end-of-buffer characters.  The first causes
  1447.      * a transition to the end-of-buffer state.  The second causes
  1448.      * a jam in that state.
  1449.      */
  1450.     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1451.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1452.  
  1453.     b->yy_buf_pos = &b->yy_ch_buf[0];
  1454.  
  1455.     b->yy_at_bol = 1;
  1456.     b->yy_buffer_status = YY_BUFFER_NEW;
  1457.  
  1458.     if ( b == yy_current_buffer )
  1459.         yy_load_buffer_state();
  1460.     }
  1461.  
  1462.  
  1463. #ifndef YY_NO_SCAN_BUFFER
  1464. #ifdef YY_USE_PROTOS
  1465. YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
  1466. #else
  1467. YY_BUFFER_STATE yy_scan_buffer( base, size )
  1468. char *base;
  1469. yy_size_t size;
  1470. #endif
  1471.     {
  1472.     YY_BUFFER_STATE b;
  1473.  
  1474.     if ( size < 2 ||
  1475.          base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1476.          base[size-1] != YY_END_OF_BUFFER_CHAR )
  1477.         /* They forgot to leave room for the EOB's. */
  1478.         return 0;
  1479.  
  1480.     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1481.     if ( ! b )
  1482.         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1483.  
  1484.     b->yy_buf_size = size - 2;    /* "- 2" to take care of EOB's */
  1485.     b->yy_buf_pos = b->yy_ch_buf = base;
  1486.     b->yy_is_our_buffer = 0;
  1487.     b->yy_input_file = 0;
  1488.     b->yy_n_chars = b->yy_buf_size;
  1489.     b->yy_is_interactive = 0;
  1490.     b->yy_at_bol = 1;
  1491.     b->yy_fill_buffer = 0;
  1492.     b->yy_buffer_status = YY_BUFFER_NEW;
  1493.  
  1494.     yy_switch_to_buffer( b );
  1495.  
  1496.     return b;
  1497.     }
  1498. #endif
  1499.  
  1500.  
  1501. #ifndef YY_NO_SCAN_STRING
  1502. #ifdef YY_USE_PROTOS
  1503. YY_BUFFER_STATE yy_scan_string( yyconst char *str )
  1504. #else
  1505. YY_BUFFER_STATE yy_scan_string( str )
  1506. yyconst char *str;
  1507. #endif
  1508.     {
  1509.     int len;
  1510.     for ( len = 0; str[len]; ++len )
  1511.         ;
  1512.  
  1513.     return yy_scan_bytes( str, len );
  1514.     }
  1515. #endif
  1516.  
  1517.  
  1518. #ifndef YY_NO_SCAN_BYTES
  1519. #ifdef YY_USE_PROTOS
  1520. YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
  1521. #else
  1522. YY_BUFFER_STATE yy_scan_bytes( bytes, len )
  1523. yyconst char *bytes;
  1524. int len;
  1525. #endif
  1526.     {
  1527.     YY_BUFFER_STATE b;
  1528.     char *buf;
  1529.     yy_size_t n;
  1530.     int i;
  1531.  
  1532.     /* Get memory for full buffer, including space for trailing EOB's. */
  1533.     n = len + 2;
  1534.     buf = (char *) yy_flex_alloc( n );
  1535.     if ( ! buf )
  1536.         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1537.  
  1538.     for ( i = 0; i < len; ++i )
  1539.         buf[i] = bytes[i];
  1540.  
  1541.     buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
  1542.  
  1543.     b = yy_scan_buffer( buf, n );
  1544.     if ( ! b )
  1545.         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1546.  
  1547.     /* It's okay to grow etc. this buffer, and we should throw it
  1548.      * away when we're done.
  1549.      */
  1550.     b->yy_is_our_buffer = 1;
  1551.  
  1552.     return b;
  1553.     }
  1554. #endif
  1555.  
  1556.  
  1557. #ifndef YY_NO_PUSH_STATE
  1558. #ifdef YY_USE_PROTOS
  1559. static void yy_push_state( int new_state )
  1560. #else
  1561. static void yy_push_state( new_state )
  1562. int new_state;
  1563. #endif
  1564.     {
  1565.     if ( yy_start_stack_ptr >= yy_start_stack_depth )
  1566.         {
  1567.         yy_size_t new_size;
  1568.  
  1569.         yy_start_stack_depth += YY_START_STACK_INCR;
  1570.         new_size = yy_start_stack_depth * sizeof( int );
  1571.  
  1572.         if ( ! yy_start_stack )
  1573.             yy_start_stack = (int *) yy_flex_alloc( new_size );
  1574.  
  1575.         else
  1576.             yy_start_stack = (int *) yy_flex_realloc(
  1577.                     (void *) yy_start_stack, new_size );
  1578.  
  1579.         if ( ! yy_start_stack )
  1580.             YY_FATAL_ERROR(
  1581.             "out of memory expanding start-condition stack" );
  1582.         }
  1583.  
  1584.     yy_start_stack[yy_start_stack_ptr++] = YY_START;
  1585.  
  1586.     BEGIN(new_state);
  1587.     }
  1588. #endif
  1589.  
  1590.  
  1591. #ifndef YY_NO_POP_STATE
  1592. static void yy_pop_state()
  1593.     {
  1594.     if ( --yy_start_stack_ptr < 0 )
  1595.         YY_FATAL_ERROR( "start-condition stack underflow" );
  1596.  
  1597.     BEGIN(yy_start_stack[yy_start_stack_ptr]);
  1598.     }
  1599. #endif
  1600.  
  1601.  
  1602. #ifndef YY_NO_TOP_STATE
  1603. static int yy_top_state()
  1604.     {
  1605.     return yy_start_stack[yy_start_stack_ptr - 1];
  1606.     }
  1607. #endif
  1608.  
  1609. #ifndef YY_EXIT_FAILURE
  1610. #define YY_EXIT_FAILURE 2
  1611. #endif
  1612.  
  1613. #ifdef YY_USE_PROTOS
  1614. static void yy_fatal_error( yyconst char msg[] )
  1615. #else
  1616. static void yy_fatal_error( msg )
  1617. char msg[];
  1618. #endif
  1619.     {
  1620.     (void) fprintf( stderr, "%s\n", msg );
  1621.     exit( YY_EXIT_FAILURE );
  1622.     }
  1623.  
  1624.  
  1625.  
  1626. /* Redefine yyless() so it works in section 3 code. */
  1627.  
  1628. #undef yyless
  1629. #define yyless(n) \
  1630.     do \
  1631.         { \
  1632.         /* Undo effects of setting up yytext. */ \
  1633.         yytext[yyleng] = yy_hold_char; \
  1634.         yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
  1635.         yy_hold_char = *yy_c_buf_p; \
  1636.         *yy_c_buf_p = '\0'; \
  1637.         yyleng = n; \
  1638.         } \
  1639.     while ( 0 )
  1640.  
  1641.  
  1642. /* Internal utility routines. */
  1643.  
  1644. #ifndef yytext_ptr
  1645. #ifdef YY_USE_PROTOS
  1646. static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
  1647. #else
  1648. static void yy_flex_strncpy( s1, s2, n )
  1649. char *s1;
  1650. yyconst char *s2;
  1651. int n;
  1652. #endif
  1653.     {
  1654.     register int i;
  1655.     for ( i = 0; i < n; ++i )
  1656.         s1[i] = s2[i];
  1657.     }
  1658. #endif
  1659.  
  1660.  
  1661. #ifdef YY_USE_PROTOS
  1662. static void *yy_flex_alloc( yy_size_t size )
  1663. #else
  1664. static void *yy_flex_alloc( size )
  1665. yy_size_t size;
  1666. #endif
  1667.     {
  1668.     return (void *) malloc( size );
  1669.     }
  1670.  
  1671. #ifdef YY_USE_PROTOS
  1672. static void *yy_flex_realloc( void *ptr, yy_size_t size )
  1673. #else
  1674. static void *yy_flex_realloc( ptr, size )
  1675. void *ptr;
  1676. yy_size_t size;
  1677. #endif
  1678.     {
  1679.     /* The cast to (char *) in the following accommodates both
  1680.      * implementations that use char* generic pointers, and those
  1681.      * that use void* generic pointers.  It works with the latter
  1682.      * because both ANSI C and C++ allow castless assignment from
  1683.      * any pointer type to void*, and deal with argument conversions
  1684.      * as though doing an assignment.
  1685.      */
  1686.     return (void *) realloc( (char *) ptr, size );
  1687.     }
  1688.  
  1689. #ifdef YY_USE_PROTOS
  1690. static void yy_flex_free( void *ptr )
  1691. #else
  1692. static void yy_flex_free( ptr )
  1693. void *ptr;
  1694. #endif
  1695.     {
  1696.     free( ptr );
  1697.     }
  1698.  
  1699. #if YY_MAIN
  1700. int main()
  1701.     {
  1702.     yylex();
  1703.     return 0;
  1704.     }
  1705. #endif
  1706. #line 149 "xcat.l"
  1707.  
  1708.  
  1709. int main(int argc, char *argv[]) 
  1710. {
  1711.     if (argc == 2)
  1712.         register_file = argv[1];
  1713.  
  1714.     yylex();
  1715.     return 0;
  1716. }
  1717.  
  1718. static int get_set_number(void)
  1719. {
  1720.     if (register_file) {
  1721.         FILE *file;
  1722.  
  1723.         if ( (file = fopen(register_file, "r")) ) {
  1724.             char line[1024];
  1725.  
  1726.             while ( fgets(line, 1023, file) ) {
  1727.                 if (*line == '#')
  1728.                     continue;
  1729.                 if (strncmp(line, yytext, yyleng - 3) == 0 &&
  1730.                     isspace(*(line + yyleng - 3))) {
  1731.                     fclose(file);
  1732.                     return atoi( line + yyleng - 3 + 1 );
  1733.                 }
  1734.             }
  1735.             error (1, 0, "set \"%s\" in %s not found, aborting",
  1736.                    yytext, register_file);
  1737.         }
  1738.     } 
  1739.     return 1;
  1740. }
  1741.  
  1742. /* for compatibility with systems not having libfl */
  1743. int yywrap(void)
  1744. {
  1745.     return 1;
  1746. }
  1747.  
  1748.